package com.itetchologyandenglish.home.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.itetchologyandenglish.home.enetity.Company;
import com.itetchologyandenglish.home.enetity.Orders;
import com.itetchologyandenglish.home.mapper.OrdersMapper;
import com.itetchologyandenglish.home.service.OrdersService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class OrderServiceImpl implements OrdersService {
    @Resource
    OrdersMapper ordersMapper;
    @Override
    public PageInfo findPurchaseOrderList(Orders orders) {
        System.out.println("我是:"+orders);
        PageHelper.clearPage();
        PageHelper.startPage(orders.getPageNum(),5);
        List<Orders> orderList=ordersMapper.getOrders(orders);
        PageInfo pageInfo=new PageInfo(orderList);
        return pageInfo;
    }

    @Override
    public Orders findPurchaseOrderByid(Integer orderId) {
        return ordersMapper.getOrdersById(orderId);
    }

    @Override
    public boolean updatePurchaseOrder(Orders orders) {
        return ordersMapper.updatePurchaseOrder(orders)>0?true:false;
    }

    @Override
    public boolean deletePurchaseOrder(Integer orderId) {
        return ordersMapper.deletePurchaseOrder(orderId)>0?true:false;
    }

    @Override
    public boolean addPurchaseOrder(Orders orders) {
        return ordersMapper.addPurchaseOrder(orders)>0?true:false;
    }
}
